package com.ktgj.customer.mapper;

import java.util.Date;
import java.util.List;
import com.ktgj.customer.domain.Customer;
import com.ktgj.customer.domain.CustomerMessage;
import com.ktgj.customer.domain.dto.CustomerCRMDataDTO;
import com.ktgj.customer.domain.dto.CustomerInfoDTO;
import com.ktgj.customer.domain.vo.*;
import org.apache.ibatis.annotations.Param;

/**
 * 会员基本信息Mapper接口
 * 
 * @author ruoyi
 * @date 2021-07-30
 */
public interface CustomerMapper 
{
    /**
     * 查询会员基本信息
     * 
     * @param customerId 会员基本信息ID
     * @return 会员基本信息
     */
    public Customer selectCustomerById(Long customerId);

    /**
     * 根据openid查询用户
     * @param openid
     * @return
     */
    public Customer selectCustomerByOpenId(String openid);

    /**
     * 查询退卡
     * @param phone
     * @return
     */
    public List<CustomerReturnCard> selectCustomerReturnCardByPhone(String phone);

    /**
     * 查询退卡
     * @param phone
     * @return
     */
    public List<CustomerReturnCard> tmpSelectCustomerReturnCardByPhone(String phone);


    /**
     * 查询出当前系统中一年以前生效的会员信息
     * @return
     */
    List<CustomerInfoDTO> getCustomerCardInfo(CustomerResource customerResource);
    /**
     * 查询会员基本信息列表
     * 
     * @param customer 会员基本信息
     * @return 会员基本信息集合
     */
    public List<Customer> selectCustomerList(Customer customer);

    /**
     * 新增会员基本信息
     * 
     * @param customer 会员基本信息
     * @return 结果
     */
    public int insertCustomer(Customer customer);

    /**
     * 修改会员基本信息
     * 
     * @param customer 会员基本信息
     * @return 结果
     */
    public int updateCustomer(Customer customer);

    /**
     * 删除会员基本信息
     * 
     * @param customerId 会员基本信息ID
     * @return 结果
     */
    public int deleteCustomerById(Long customerId);

    /**
     * 批量删除会员基本信息
     * 
     * @param customerIds 需要删除的数据ID
     * @return 结果
     */
    public int deleteCustomerByIds(Long[] customerIds);

    public Customer customerLogin(@Param("loginId") String loginId, @Param("loginPwd") String loginPwd);

    public int updatePwd(@Param("customerId") Long customerId, @Param("pwd") String pwd);

    public int updatetrainPassword(@Param("customerId") Long customerId, @Param("trainPassword") String trainPassword);

    public Customer customerPhoneLogin(@Param("phone") String phone);

    /**
     * 会员基本信息与常用地址对象关联查询（一对多）
     * @param customerId
     * @return
     */
    public List<Customer> selectCustomerAndCommonAddressesList(Long customerId);

    /**
     * 会员基本信息与常用报销凭证信息对象关联查询（一对多）
     * @param customerId
     * @return
     */
    public List<Customer> selectCustomerAndCommonReimbursementsList(Long customerId);

    /**
     * 会员基本信息与常用旅客信息对象关联查询（一对多）
     * @param customerId
     * @return
     */
    public List<Customer> selectCustomerAndCommonTravelersList(Long customerId);

    /**
     * 会员基本信息与银行卡信息对象关联查询（一对多）
     * @param customerId
     * @return
     */
    public List<Customer> selectCustomerAndBankCardList(Long customerId);

    /**
     * 我的-编辑个人信息
     * @param customer
     * @return
     */
    public Customer updateCustomerLogin(Customer customer);

    /**
     * 我的-添加证件
     * @param customer
     * @return
     */
    public int updateCustomerByCertificate(Customer customer);

    /**
     * 修改密码
     * */
    public int updateCustomerByCustLoginPswmd5(Customer customer);

    /**
     * 根据会员Id查询当前密码
     * */
    public Customer selectCustomerByCustomerIdMd5(Long customerId);

    /**
     * 写新反馈(查询)
     * */
    public Customer selectCustomerBYContractPhoneOne(Long customerId);

    /**
     * 根据手机号查询
     * */
    public Customer selectCustomerByContractPhoneOnes(String contractPhoneOne);

    /**
     * 根据id查询
     * */
    public Customer selectCustomerByCustomerId(Long customerId);

    /**
     * 查询个人信息
     * */
    public Customer selectCustomerLogin(Long customerId);

    /**
     * 查询会员证件号
     * */
    public Customer certificate(Long customerId);

    String getCustomerCardDisplay(Long customerId);

    Date getCustomerCardExpireDays(Long customerId);

    Customer selectCustomerPhoneById(Long customerId);

    /**
     * 随机获取5000名没有关联vip经理的会员信息
     * */
    public List<Customer> selectCustomerByList();

    /**
     * 除列表外的会员信息
     * */
    public List<Customer> randomCustomer(List<Long> idList);

    /**
     * 查询会员信息
     * @param phone
     * @param idCode
     * @return
     */
    public Customer queryCustomer(@Param("phone") String phone, @Param("idCode") String idCode, @Param("id") Long id);

    /**
     * 会员识别查询
     * @param customerIdentify
     * @return
     */
    public List<CustomerIdentify> selectCustomerIdentify(CustomerIdentify customerIdentify);

    /**
     * 会员识别查询 查积分
     * @param customerId
     * @return
     */
    public List<CustomerIdentify> selectPointBy(Long customerId);

    /**
     * 手机号查询会员信息
     * */
    public Customer customerByPhone(String phone);

    /**
     * 会员姓名查id
     * */
    public Customer customerByCustomerName(String customerName);
    /**
     * 退卡审核
     * @param cardCode
     * @return
     */
    public CustomerReturnCard selectCustomerReturnCardBycardCode(String cardCode);

    /**
     * 查询会员卡
     * @param customerId
     * @return
     */
    public List<CustomerReturnCard> getCustomerCardByCustomerId(Long customerId);

    /**
     * 退卡审核2
     * @param customerReturnCard
     * @return
     */
    public List<CustomerReturnCard> selectCustomerReturnCardByorderDate(CustomerReturnCard customerReturnCard);

    /**
     *
     * @param cardStartId
     * @return
     */
    public CustomerReturnCard getCardStartName(Long cardStartId);


    CustomerCRMDataDTO queryCustomerCondition(@Param("customerId") Long customerId, @Param("phone") String phone, @Param("certificateNo") String certificateNo, @Param("cardCode") String cardCode, @Param("customerName") String customerName);

    public Customer InquireCustomerById(Long customerId);
    /**
     * 检索三个月内未读的会员消息
     */
    public List<CustomerMessage> selectCustomerMessage(CustomerMessage customerMessage);
    /**
     * 检索三个月所有的会员消息
     */
    public List<CustomerMessage> selectAllCustomerMessage(CustomerMessage customerMessage);
    /**
     * 新增会员消息
     */
    public int addCustomerMessage(CustomerMessage customerMessage);
    /**
     * 修改会员消息状态
     */
    public int updateCustomerMessage(CustomerMessage customerMessage);

    /**
     * 工单查询会员部分信息
     * */
    public Customer selectCustomerIdByCustomerIdVo(CustomerIdVo customerIdVo);

    /**
     * 会员 姓名/手机号查信息
     * */
    public Customer nameAndPhone(@Param("name") String name, @Param("phone") String phone);
}
